package com.aaa.config;

import com.sun.deploy.Environment;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Profiles;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.Socket;
import java.util.ArrayList;
import java.util.concurrent.Executor;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.aaa.controller"))
                //过滤什么开头的接口
//                .paths(PathSelectors.ant("/aaa/**"))
                .build();
    }

    public ApiInfo apiInfo(){
        Contact java002 = new Contact("付饶", "", "826725313@qq.com");
        return new ApiInfo("付饶的SwaggerAPI文档",
                "唯有努力不欺人",
                "v1.0",
                "urn:tos",
                java002,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());
    }
}
